import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import { Routes } from './config'
const router = createRouter({
    routes: [
        {
            path: "/",
            redirect: "/login/index"
        }
    ],
    history: createWebHashHistory()
})
Routes.forEach((item) => {
    router.addRoute(item)
})

router.beforeEach((to, from, next) => {
    // 判断有没有登录
    const { meta } = to;
    if (meta && meta.title) {
        document.title = meta.title;
    }
    next();
});

export default router